; (function () {
  new Vue({
    el: '#useManage',
    data: {
      quanxian: JSON.parse(localStorage.getItem('permissions')),
      keyword: '',
      flag: false,
      data: [],
      templateId: '',
      edit: {name: '', memo: '',seq: '#', id: ''}
    },
    methods: {
      // 设置背景色
      addbgcolor (index) {
        let el = document.querySelectorAll('.house-two-tone');
        let el0 = document.querySelectorAll('.house-operate')
        el[index].classList.add('house-two-tone-hover')
        el0[index].classList.add('house-two-tone-hover')
      },
      //删除背景色
      removebgcolor (index) {
        let el = document.querySelectorAll('.house-two-tone');
        let el0 = document.querySelectorAll('.house-operate')
        el[index].classList.remove('house-two-tone-hover')
        el0[index].classList.remove('house-two-tone-hover')
      },
      //租户模版获取
			applyTagsDt () {
				hlhttp.get({
					url: 'portal/template',
					success: (data) => {
						this.templateId = data.templateId;
						this.getUseData()
					}
				})
			},
      //获取列表
      getUseData () {
        hlhttp.get({
          url: 'portal/block_list',
          data: {keyword: this.keyword ? this.keyword : '#', template_id: this.templateId},
          success: (data) => {
            this.data = data
          }
        })
      },
      //显示编辑框
      editOneList (data) {
        this.edit = {name: data.blockName, memo: data.memo, seq: '#', id: data.blockId}
        this.flag = true;
      },
      //编辑
      editPut () {
        hlhttp.put({
          url: 'portal/block',
          data: {block_id: this.edit.id, block_title: this.edit.name, memo: this.edit.memo || '#', seq: '#', template_id: this.templateId},
          success: () => {
            hl.toast('操作成功')
            this.flag = false;
            this.getUseData()
          }
        })
      },
      //重置
      resetButton () {
        this.keyword = '';
        this.getUseData()
      },
      //隐藏编辑框
      editHide () {
        this.flag = false;
      },
      //跳转
      goToNewLink (data) {
        hlUrlUtil.goTo('useManage1',{ddtab:true, blockId: data.blockId}, false)
      }
    },
    mounted () {
      this.applyTagsDt()
    }
  })
} ())
